<template>
  <div>
    <div>highlightjs 高亮编辑</div>
    <highlightjs :autodetect="true" language="javascript" :code="code"> </highlightjs>
  </div>
</template>

<script setup lang="ts">
/** 导入所有语言 */
// import hljs from "highlight.js";

/** 导入所需语言 */
/// Using ES6 import syntax
import hljs from "highlight.js/lib/core";
import javascript from "highlight.js/lib/languages/javascript";

// Then register the languages you need
hljs.registerLanguage("javascript", javascript);
hljs.highlightAll();

const code = `
onMounted(() => { console.log("role-mounted"); });
`;
</script>

<style scoped></style>
